#include <stdio.h>
int main(int argc, char const *argv[])
{
    int user = 111;
    int paswd = 123;
    int my_user, my_paswd;
    int flag1 = 3;
    int flag2 = 3;
    while (flag1)
    {
        printf("请输入你的账号:\n");
        scanf("%d", &my_user);
        if (my_user == user)
        {
            while (flag2)
            {
                printf("请输入你的密码:\n");
                scanf("%d", &my_paswd);
                if (my_paswd == paswd)
                {
                    printf("登录成功!\n");
                    return -1;     //return -1 结束当前程序，而break只能停止内存循环
                }
                else
                {
                    printf("密码错误!请重新输入密码,你当前还剩%d次机会\n",flag2-1);
                    flag2 = flag2 - 1;
                }
            }
        }
        else
        {
            printf("账号错误!请重新输入账号,你当前还剩%d次机会\n",flag1-1);
            flag1 = flag1 - 1;
        }
    }
}
